import java.util.Scanner;

public class WordReverser {
    public static String reverseWords(String s, int start, int end) {
        // 将字符串按空格分割成单词数组
        String[] words = s.split(" ");

        // 检查起始和结束边界
        if (start < 0 || end >= words.length || start > end) {
            return "Invalid range";
        }

        // 反转指定区间的单词
        while (start < end) {
            String temp = words[start];
            words[start] = words[end];
            words[end] = temp;
            start++;
            end--;
        }

        // 将数组重新拼接为字符串
        return String.join(" ", words);
    }

    public static void main(String[] args) {
        String s = "I am a developer";
        Scanner scanner = new Scanner(System.in);
        int start = scanner.nextInt();
        int end = scanner.nextInt();

        String result = reverseWords(s, start, end);
        System.out.println(result);  // 输出: developer a am I
    }
}
